import { NestFactory } from '@nestjs/core';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { AppModule } from './app.module';
import { global_middleware } from './middleware/global.middleware';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.use(global_middleware);
  const options = new DocumentBuilder()
    .setTitle('Nest Starter')
    .setDescription('The Nest Starter API description')
    .setVersion('1.0')
    .addTag('Nest')
    .build();
  const document = SwaggerModule.createDocument(app, options);
  SwaggerModule.setup('api', app, document);
  await app.listen(3000).then((_) => {
    console.log('server is lisitening 3000 :>>  ');
  });
}
bootstrap();
